package com.xc.controller;

import com.xc.dto.ResultDTO;
import com.xc.entity.PermissionEntity;
import com.xc.service.PermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//restful 增加post，修改put，删除delete，查询get
@RestController
@RequestMapping("/xc/per")
@Api(tags = "权限功能管理")
public class PermissionController {
    @Autowired
    private PermissionService permissionService;

    @ApiOperation(value = "权限功能增加",notes = "权限功能增加接口的说明")
    @PostMapping()
    public ResultDTO add(PermissionEntity permissionEntity) {
        return permissionService.add(permissionEntity);
    }

    @ApiOperation("权限功能修改")
    @PutMapping()
    public ResultDTO update(PermissionEntity permissionEntity) {
        return permissionService.update(permissionEntity);
    }

    @ApiOperation("根据id进行删除权限功能数据")
    @DeleteMapping("/{id}")
    public ResultDTO delete(PermissionEntity permissionEntity) {
        return permissionService.delete(permissionEntity);
    }

    @ApiOperation("查询所有权限功能数据")
    @GetMapping()
    public ResultDTO findAll(PermissionEntity permissionEntity) {
        return permissionService.findAll(permissionEntity);
    }

    @ApiOperation("根据id查询权限功能")
    @GetMapping("/{id}")
    public ResultDTO findById(PermissionEntity permissionEntity) {
        return permissionService.findById(permissionEntity);
    }

    @ApiOperation("查询权限功能总条数")
    @GetMapping("/count")
    public ResultDTO count(PermissionEntity permissionEntity) {
        return permissionService.count(permissionEntity);
    }
}
